package com.zlx.controller;

import com.alibaba.fastjson.JSONObject;
import com.zlx.entities.Dept;
import com.zlx.service.DeptService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author 周罗校
 * @Description 查询部门的servlet
 * @ClassName DeptServlet
 * @date 2020.09.23 18:55:16
 * 该版权归周罗校所有，最终解释权以官方为准
 */
@WebServlet("/dept/*")
public class DeptServlet extends BaseServlet{
    private DeptService deptService = new DeptService();
    protected void list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Dept> allDept = deptService.getAllDept();
        System.out.println("123");
        String s = JSONObject.toJSONString(allDept);
        response.getWriter().write(s);
    }
}
